#include "stdlib.hpp"
#include <purewell/sharedobject.hpp>

namespace purewell
{

PWSharedObject::PWSharedObject()
{
}

PWSharedObject::~PWSharedObject()
{
}

bool
PWSharedObject::initialize(const char* path, int type)
{
	void* handle(dlopen(path,type));
	if ( !handle ) return false;
	m_pData = handle;
	return true;
}

void
PWSharedObject::destroy(void)
{
	if ( m_pData )
	{
		dlclose(m_pData);
		m_pData = NULL;
	}
}

void*
PWSharedObject::getSymbol(const char* symbol)
{
	return dlsym(m_pData, symbol);
}

};//namespace purewell


